const express = require('express');
const router = express.Router();
const uploadController = require('../controllers/upload.controller');
const { authMiddleware } = require('../middlewares/auth.middleware');

// 上传单个文件
// POST /api/upload/:type
// type: banner, product, shop, general
router.post('/:type', authMiddleware, uploadController.uploadSingle);

// 上传多个文件
// POST /api/upload/:type/multiple
router.post('/:type/multiple', authMiddleware, uploadController.uploadMultiple);

// 删除文件
// DELETE /api/upload/:type/:filename
router.delete('/:type/:filename', authMiddleware, uploadController.deleteFile);

// 获取文件信息
// GET /api/upload/:type/:filename/info
router.get('/:type/:filename/info', uploadController.getFileInfo);

module.exports = router;
